#include<iostream>
#include<vector>
using namespace std;
const int N = 1e5 + 10;
int arr[N];
vector<int>ans;
int n, x;
int main()
{
	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	int l = -1, r = n;
	while (l + 1 < r) {
		int mid = l + r >> 1;
		if (arr[mid] < x)l = mid;
		else r = mid;
	}
	if (arr[r] != x) {
		ans.push_back(-1);
		ans.push_back(-1);
	}
	else {
		ans.push_back(r);
		l = -1, r = n;
		while (l + 1 < r) {
			int mid = l + r >> 1;
			if (arr[mid] <= x)l = mid;
			else r = mid;
		}
		ans.push_back(l);
	}
	for (int x : ans) {
		cout << x << " ";
	}
	return 0;
}